<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>Transitions</title>
<link rel="stylesheet" href="doc.css" type="text/css" />
</head>
<body>
<div class="document">
<div class="navigation navigation-header container">
<span class="previous">Previous: <a class="reference" href="using_director_s_api.html" title="Using Director's API">Using Director's API</a></span><span class="next">Next: <a class="reference" href="tiled_maps.html" title="Tiled maps">Tiled maps</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="scenes_transitions.html" title="Scenes &amp; Transitions">Scenes &amp; Transitions</a> » Transitions</span></div>
<h1 class="title">Transitions</h1>

<p>A nicer way to change between scenes, is to <em>decorate</em> the new scene with
a <em>Transition</em> <em>Scene</em>.</p>
<p><strong>Technically</strong>, a transition scene is an scene that performs a transition effect before
setting control to the new scene.</p>
<p>And <strong>visually</strong>, a transition scene is like the transitions you see using any
presentation software like OpenOffice Impress, Apple's KeyNote or PowerPoint.</p>
<img alt="transition.png" src="transition.png" />
<p>Example:</p>
<pre class="py-doctest">
<span class="py-comment"># import all the transitions</span>
<span class="py-keyword">from</span> cocos.scenes <span class="py-keyword">import</span> *

<span class="py-comment"># using director replace</span>
<span class="py-comment"># using the Fade-Top-Right Transition that lasts 2 seconds</span>
director.replace( FadeTRTransition( gameover_scene, duration=2 ) )


<span class="py-comment"># or, using 'push' with the Flip-X transition that lasts 1 second.</span>
director.push( FlipX3DTransition( gameover_scene, duration=1 ) )</pre>
<dl class="docutils">
<dt>List of available transitions:</dt>
<dd><ul class="first last simple">
<li><a class="reference apilink" href="../api/cocos.scenes.transitions-module.html " title="cocos.scenes.transitions">transitions</a></li>
</ul>
</dd>
</dl>
<div class="navigation navigation-footer container">
<span class="previous">Previous: <a class="reference" href="using_director_s_api.html" title="Using Director's API">Using Director's API</a></span><span class="next">Next: <a class="reference" href="tiled_maps.html" title="Tiled maps">Tiled maps</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="scenes_transitions.html" title="Scenes &amp; Transitions">Scenes &amp; Transitions</a> » Transitions</span></div>
</div>
</body>
</html>
